package com.hf.buildtb.serviceImpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hf.base.shh.BaseServiceImpl;
 
import com.hf.buildtb.dao.BiCorporationDao;
 
import com.hf.buildtb.entity.BiCorporation;
 
import com.hf.buildtb.formodel.BiCorporationForm;
import com.hf.buildtb.service.BiCorporationService;

@Service("biCorporationService")
public class BiCorporationServiceImpl extends BaseServiceImpl <BiCorporationForm,BiCorporation,BiCorporationDao> implements BiCorporationService {

 
 
 

	@Override
	public BiCorporationForm getPage(BiCorporation entity) {
		// TODO Auto-generated method stub
		// TODO Auto-generated method stub
		BiCorporationForm bForm = new BiCorporationForm();		 
		String hql =" from  BiCorporation ";
		Map<String, Object> params = new HashMap<String, Object>();
		if (!(entity==null) ){
			hql =hql+" where 1=1  ";
			if ((entity.getCorpName()!=null)&&!entity.getCorpName().equals("")) {
				params.put("name", entity.getCorpName()+"%");
				hql =hql+" and name like:name ";
			}			 
			bForm.setEntity(entity);								 
		}
		 
		List<BiCorporation> list=	dao.find(hql,params);
		 
		bForm.setEntities(list);
		bForm.setEntity(entity);
		return 	bForm;
	} 
}
